/*
 *         Copyright (c) KUBOTA Corporation and HUDSON SOFT,
 *                  1994, 1995 All Rights Reserved
 *
 *  This software comprises unpublished confidential information of
 *  KUBOTA Corp. and HUDSON SOFT. It may not be used, copied or made 
 *  available to anyone, except in accordance with the license under
 *  which it is furnished.
 */
static char SccsId[] = "@(#)otest.c	1.6	9/19/95";
#include <farl.h>
#include <agl.h>
#define TOTAL_ROTATE 7200
#define ROTATE_ANGLE 20
#define TOTAL_TRANS 0x160
#define TRANS_STEP 0x5
unsigned int cube[] = {
#include "cubestp.h"
};

void main()
{
     register int	i;
     object		obj;
     Material		mt1;

     FX73init();
     FX73_cmap_i6c3();
     AGLInit();

     FarlSetPEClearColorReg(0x201);
     FarlSetTEControlReg(FARL_TE_LTEN|FARL_TE_ICM|FARL_TE_BCE|FARL_TE_SPEN);
     FarlValidateSwap();

     AGLSetLight(AGL_LIGHT1, 0x0, 0x5a82, ~0x5a82+1, 0x0); /* 0x5a82 = 0.7070922 */

     mt1.ambient  = 0x1000;
     mt1.diffuse  = 0x4000;
     mt1.specular = 0x1fff;
     AGLSetMaterial(&mt1, 1);

     obj.geometryTop    = cube;
     obj.geometryLength = sizeof(cube)/sizeof(int);
     obj.material       = &mt1;

     AGLResetCamera();
     AGLTranslateCamera(0x0, 0x0, 0x80);
     AGLZoomCamera(0x40, 0x40, 0x40);
     AGLPerspectiveCamera(0xffc0);

     /* オブジェクトのＸ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjX(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }

     /* オブジェクトのＹ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjY(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }

     /* オブジェクトのＺ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }

     /* オブジェクトのＸＹ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }

     /* オブジェクトのＸＺ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }

     /* オブジェクトのＹＺ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＹＸ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjX(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＺＸ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLRotateObjX(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＺＹ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＸＹＺ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＹＸＺ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＸＺＹ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＹＺＸ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLRotateObjX(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＺＸＹ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのＺＹＸ軸回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjX(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトの移動＋ＸＹＺ回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLTranslateObj(&obj, 0x20, 0x30, 0x40);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* ＸＹＺ回転＋オブジェクトの移動 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLTranslateObj(&obj, 0x20, 0x30, 0x40);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのスケール＋ＸＹＺ回転 */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLScaleObj(&obj, 0x40, 0x50, 0x60);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* ＸＹＺ回転＋オブジェクトのスケール */
     for (i = 0; i <= TOTAL_ROTATE; i += ROTATE_ANGLE) {
	  AGLResetObj(&obj);
	  AGLRotateObjX(&obj, i%3600);
	  AGLRotateObjY(&obj, i%3600);
	  AGLRotateObjZ(&obj, i%3600);
	  AGLScaleObj(&obj, 0x40, 0x50, 0x60);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトの移動＋オブジェクトのスケール */
     for (i = 0; i <= TOTAL_TRANS; i += TRANS_STEP) {
	  AGLResetObj(&obj);
	  AGLTranslateObj(&obj, i - TOTAL_TRANS/2, i - TOTAL_TRANS/2,
			  i - TOTAL_TRANS/2);
	  AGLScaleObj(&obj, 0x40, 0x50, 0x60);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのスケール＋オブジェクトの移動 */
     for (i = 0; i <= TOTAL_TRANS; i += TRANS_STEP) {
	  AGLResetObj(&obj);
	  AGLScaleObj(&obj, 0x40, 0x50, 0x60);
	  AGLTranslateObj(&obj, i - TOTAL_TRANS/2, i - TOTAL_TRANS/2,
			  i - TOTAL_TRANS/2);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトの移動＋オブジェクトのスケール＋ＸＹＺ回転 */
     for (i = 0; i <= TOTAL_TRANS; i += TRANS_STEP) {
	  AGLResetObj(&obj);
	  AGLTranslateObj(&obj, i - TOTAL_TRANS/2, i - TOTAL_TRANS/2,
			  i - TOTAL_TRANS/2);
	  AGLScaleObj(&obj, 0x50, 0x60, 0x70);
	  AGLRotateObjX(&obj, (i*3)%3600);
	  AGLRotateObjY(&obj, (i*3)%3600);
	  AGLRotateObjZ(&obj, (i*3)%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトの移動＋ＸＹＺ回転＋オブジェクトのスケール */
     for (i = 0; i <= TOTAL_TRANS; i += TRANS_STEP) {
	  AGLResetObj(&obj);
	  AGLTranslateObj(&obj, i - TOTAL_TRANS/2, i - TOTAL_TRANS/2,
			  i - TOTAL_TRANS/2);
	  AGLRotateObjX(&obj, (i*3)%3600);
	  AGLRotateObjY(&obj, (i*3)%3600);
	  AGLRotateObjZ(&obj, (i*3)%3600);
	  AGLScaleObj(&obj, 0x50, 0x60, 0x70);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのスケール＋オブジェクトの移動＋ＸＹＺ回転 */
     for (i = 0; i <= TOTAL_TRANS; i += TRANS_STEP) {
	  AGLResetObj(&obj);
	  AGLScaleObj(&obj, 0x50, 0x60, 0x70);
	  AGLTranslateObj(&obj, i - TOTAL_TRANS/2, i - TOTAL_TRANS/2,
			  i - TOTAL_TRANS/2);
	  AGLRotateObjX(&obj, (i*3)%3600);
	  AGLRotateObjY(&obj, (i*3)%3600);
	  AGLRotateObjZ(&obj, (i*3)%3600);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* オブジェクトのスケール＋ＸＹＺ回転＋オブジェクトの移動 */
     for (i = 0; i <= TOTAL_TRANS; i += TRANS_STEP) {
	  AGLResetObj(&obj);
	  AGLScaleObj(&obj, 0x50, 0x60, 0x70);
	  AGLRotateObjX(&obj, (i*3)%3600);
	  AGLRotateObjY(&obj, (i*3)%3600);
	  AGLRotateObjZ(&obj, (i*3)%3600);
	  AGLTranslateObj(&obj, i - TOTAL_TRANS/2, i - TOTAL_TRANS/2,
			  i - TOTAL_TRANS/2);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* ＸＹＺ回転＋オブジェクトのスケール＋オブジェクトの移動 */
     for (i = 0; i <= TOTAL_TRANS; i += TRANS_STEP) {
	  AGLResetObj(&obj);
	  AGLScaleObj(&obj, 0x50, 0x60, 0x70);
	  AGLRotateObjY(&obj, (i*3)%3600);
	  AGLRotateObjZ(&obj, (i*3)%3600);
	  AGLRotateObjX(&obj, (i*3)%3600);
	  AGLTranslateObj(&obj, i - TOTAL_TRANS/2, i - TOTAL_TRANS/2,
			  i - TOTAL_TRANS/2);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     /* ＸＹＺ回転＋オブジェクトの移動＋オブジェクトのスケール */
     for (i = 0; i <= TOTAL_TRANS; i += TRANS_STEP) {
	  AGLResetObj(&obj);
	  AGLRotateObjY(&obj, (i*3)%3600);
	  AGLRotateObjZ(&obj, (i*3)%3600);
	  AGLRotateObjX(&obj, (i*3)%3600);
	  AGLTranslateObj(&obj, i - TOTAL_TRANS/2, i - TOTAL_TRANS/2,
			  i - TOTAL_TRANS/2);
	  AGLScaleObj(&obj, 0x50, 0x60, 0x70);
	  AGLFixPutObj(&obj);
	  AGLShot();
     }
     
     return;
}
